<%@ page language="java" contentType="text/html; charset=utf-8"
	pageEncoding="utf-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jstl/core"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<script src="http://code.jquery.com/jquery-latest.js"></script>
<title>Insert title here</title>
</head>
<body>
	<label id="view"></label>
	<button onclick="jsonTest()">json</button>
	<button onclick="keyValueTest()">key/value</button>
	<hr>
	<div id ="xianshi"></div>
</body>
<script type="text/javascript">
	function jsonTest() {

		$.ajax({
			type:"post",
			url : "${pageContext.request.contextPath }/user/json",
			data : '{"id":1}',
			contentType:'application/json;charset=UTF-8', 
			success : function(data) {
				console.log(data);
			}
		});
		
	}

	function keyValueTest() {
		$.get("${pageContext.request.contextPath }/user/keyValue","id=1", 
				function(data) {
					console.log(data);
					//json数据使用.的方式获得结果
					console.log(data.phone);
				});
		}
</script>
</html>